// 自动生成模板CusUser
package customer

import (
	"counter-help/admin/server/global"
	"github.com/gofrs/uuid/v5"
	"time"
)

// cusUser表 结构体  CusUser
type CusUser struct {
	global.GVA_MODEL
	UUID      uuid.UUID  `json:"uuid" gorm:"index;comment:用户UUID"`                                         //用户UUID
	Username  string     `json:"username" form:"username" gorm:"column:username;comment:用户登陆名;size:191;" ` //用户登陆名
	Sex       string     `json:"sex" form:"sex" gorm:"column:sex;comment:性别;size:191;"`                    // 性别
	Nickname  string     `json:"nickname" form:"nickname" gorm:"column:nickname;comment:用户昵称;size:191;"`   //用户昵称
	Password  string     `json:"password" form:"password" gorm:"column:password;comment:用户密码;size:191;"`   //用户密码
	Avatar    string     `json:"avatar" form:"avatar" gorm:"column:avatar;comment:用户头像;size:191;"`         //用户头像
	Phone     string     `json:"phone" form:"phone" gorm:"column:phone;comment:用户手机号;size:191;" `          //用户手机号
	Unionid   string     `json:"unionid" form:"unionid" gorm:"column:unionid;comment:微信小程序unionid;size:191;"`
	Openid    string     `json:"openid" form:"openid" gorm:"column:openid;comment:微信小程序openId;size:191;"`          //微信小程序OpenId
	GzhOpenid string     `json:"gzh_openid" form:"gzh_openid" gorm:"column:gzh_openid;comment:微信OpenId;size:191;"` //微信OpenId
	Address   string     `json:"address" form:"address" gorm:"column:address;comment:用户地址;size:191;"`              //用户地址
	IniviteBy string     `json:"iniviteBy" form:"iniviteBy" gorm:"column:inivite_by;comment:邀请用户手机号;size:191;"`    //邀请用户手机号
	Voucher   string     `json:"voucher" form:"voucher" gorm:"column:voucher;comment:代金劵;size:191;"`               //代金劵
	Birth     *time.Time `json:"birth" form:"birth" gorm:"column:birth;comment:出生日期;"`                             //出生日期
	Resume    string     `json:"resume" form:"resume" gorm:"column:resume;comment:案例（个人简历）;size:191;"`             //案例（个人简历）
	Unit      string     `json:"unit" form:"unit" gorm:"column:unit;comment:单位;size:191;"`                         //单位
	Role      *int       `json:"role" form:"role" gorm:"column:role;comment:用户角色  0 分析师  1 需求者;"`                  //用户角色  0 分析师  1 需求者
	Auth      *int       `json:"auth" form:"auth" gorm:"column:auth;comment:用户认证 关联 auth_user id;size:19;"`        //用户认证 关联 auth_user id
	Research  string     `json:"research" form:"research" gorm:"column:research;comment:研究方向;size:191;"`           //研究方向
}

// TableName cusUser表 CusUser自定义表名 cus_user
func (CusUser) TableName() string {
	return "cus_user"
}

type Login interface {
	GetUsername() string
	GetNickname() string
	GetUUID() uuid.UUID
	GetUserId() uint
	GetUserInfo() any
	GetAuthorityId() uint
}

func (s *CusUser) GetUsername() string {
	return s.Username
}

func (s *CusUser) GetNickname() string {
	return s.Nickname
}

func (s *CusUser) GetUUID() uuid.UUID {
	return s.UUID
}

func (s *CusUser) GetUserId() uint {
	return s.ID
}

func (s *CusUser) GetUserInfo() any {
	return *s
}

// GetAuthorityId TODO: 暂时写死
func (s *CusUser) GetAuthorityId() uint {
	return 888
}
